Content-type: text/html

<HTML><HEAD><TITLE>Manpage of SSH-KEYGEN</TITLE>
</HEAD><BODY>
<H1>SSH-KEYGEN</H1>
Section: User Commands  (1)<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<BR>BSD mandoc<BR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>



<B>ssh-keygen</B>

 - authentication key generation, management and conversion

<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>

<B>ssh-keygen</B>

-words

[-<B>q</B>

]

[-<B>b </B><I>bits</I>



]

-<B>t </B><I>type</I>



[-<B>N </B><I>new_passphrase</I>



]

[-<B>C </B><I>comment</I>



]

[-<B>f </B><I>output_keyfile</I>



]

<BR><B>ssh-keygen</B>



-<B>p</B>

[-<B>P </B><I>old_passphrase</I>



]

[-<B>N </B><I>new_passphrase</I>



]

[-<B>f </B><I>keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>i</B>

[-<B>f </B><I>input_keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>e</B>

[-<B>f </B><I>input_keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>y</B>

[-<B>f </B><I>input_keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>c</B>

[-<B>P </B><I>passphrase</I>



]

[-<B>C </B><I>comment</I>



]

[-<B>f </B><I>keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>l</B>

[-<B>f </B><I>input_keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>B</B>

[-<B>f </B><I>input_keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>D </B><I>reader</I>



<BR><B>ssh-keygen</B>

-<B>U </B><I>reader</I>



[-<B>f </B><I>input_keyfile</I>



]

<BR><B>ssh-keygen</B>

-<B>r </B><I>hostname</I>



[-<B>f </B><I>input_keyfile</I>



]

[-<B>g</B>

]

<BR><B>ssh-keygen</B>

-<B>G </B><I>output_file</I>



[-<B>v</B>

]

[-<B>b </B><I>bits</I>



]

[-<B>M </B><I>memory</I>



]

[-<B>S </B><I>start_point</I>



]

<BR><B>ssh-keygen</B>

-<B>T </B><I>output_file</I>



-<B>f </B><I>input_file</I>



[-<B>v</B>

]

[-<B>a </B><I>num_trials</I>



]

[-<B>W </B><I>generator</I>



]

<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>

<B>ssh-keygen</B>


generates, manages and converts authentication keys for
<A HREF="http://localhost/cgi-bin/man/man2html?1+ssh">ssh</A>(1).


<B>ssh-keygen</B>


can create RSA keys for use by SSH protocol version 1 and RSA or DSA
keys for use by SSH protocol version 2.
The type of key to be generated is specified with the
-<B>t</B>

option.
<P>

<B>ssh-keygen</B>


is also used to generate groups for use in Diffie-Hellman group
exchange (DH-GEX).
See the
Sx MODULI GENERATION

section for details.
<P>

Normally each user wishing to use SSH
with RSA or DSA authentication runs this once to create the authentication
key in
$HOME/.ssh/identity

 
$HOME/.ssh/id_dsa

or
$HOME/.ssh/id_rsa

 
Additionally, the system administrator may use this to generate host keys,
as seen in
/etc/rc

 
<P>

Normally this program generates the key and asks for a file in which
to store the private key.
The public key is stored in a file with the same name but
``.pub''

appended.
The program also asks for a passphrase.
The passphrase may be empty to indicate no passphrase
(host keys must have an empty passphrase), or it may be a string of
arbitrary length.
A passphrase is similar to a password, except it can be a phrase with a
series of words, punctuation, numbers, whitespace, or any string of
characters you want.
Good passphrases are 10-30 characters long, are
not simple sentences or otherwise easily guessable (English
prose has only 1-2 bits of entropy per character, and provides very bad
passphrases), and contain a mix of upper and lowercase letters,
numbers, and non-alphanumeric characters.
The passphrase can be changed later by using the
-<B>p</B>

option.
<P>

There is no way to recover a lost passphrase.
If the passphrase is
lost or forgotten, a new key must be generated and copied to the
corresponding public key to other machines.
<P>

For RSA1 keys,
there is also a comment field in the key file that is only for
convenience to the user to help identify the key.
The comment can tell what the key is for, or whatever is useful.
The comment is initialized to
``<A HREF="mailto:user@host">user@host</A>''

when the key is created, but can be changed using the
-<B>c</B>

option.
<P>

After a key is generated, instructions below detail where the keys
should be placed to be activated.
<P>

The options are as follows:
<DL COMPACT>
<P>

<DT><B>-a </B><I>trials</I>




<DD>
Specifies the number of primality tests to perform when screening DH-GEX
candidates using the
-<B>T</B>

command.
<DT><B>-b </B><I>bits</I>




<DD>
Specifies the number of bits in the key to create.
Minimum is 512 bits.
Generally, 1024 bits is considered sufficient.
The default is 1024 bits.
<DT><B>-c</B>


<DD>
Requests changing the comment in the private and public key files.
This operation is only supported for RSA1 keys.
The program will prompt for the file containing the private keys, for
the passphrase if the key has one, and for the new comment.
<DT><B>-e</B>


<DD>
This option will read a private or public OpenSSH key file and
print the key in a
`SECSH Public Key File Format'

to stdout.
This option allows exporting keys for use by several commercial
SSH implementations.
<DT><B>-g</B>


<DD>
Use generic DNS format when printing fingerprint resource records using the
-<B>r</B>

command.
<DT><B>-f </B><I>filename</I>




<DD>
Specifies the filename of the key file.
<DT><B>-i</B>


<DD>
This option will read an unencrypted private (or public) key file
in SSH2-compatible format and print an OpenSSH compatible private
(or public) key to stdout.
<B>ssh-keygen</B>


also reads the
`SECSH Public Key File Format'

 
This option allows importing keys from several commercial
SSH implementations.
<DT><B>-l</B>


<DD>
Show fingerprint of specified public key file.
Private RSA1 keys are also supported.
For RSA and DSA keys
<B>ssh-keygen</B>


tries to find the matching public key file and prints its fingerprint.
<DT><B>-p</B>


<DD>
Requests changing the passphrase of a private key file instead of
creating a new private key.
The program will prompt for the file
containing the private key, for the old passphrase, and twice for the
new passphrase.
<DT><B>-q</B>


<DD>
Silence
<B>ssh-keygen</B>

 
Used by
/etc/rc

when creating a new key.
<DT><B>-y</B>


<DD>
This option will read a private
OpenSSH format file and print an OpenSSH public key to stdout.
<DT><B>-t </B><I>type</I>




<DD>
Specifies the type of the key to create.
The possible values are
``rsa1''

for protocol version 1 and
``rsa''

or
``dsa''

for protocol version 2.
<DT><B>-B</B>


<DD>
Show the bubblebabble digest of specified private or public key file.
<DT><B>-C </B><I>comment</I>




<DD>
Provides the new comment.
<DT><B>-D </B><I>reader</I>




<DD>
Download the RSA public key stored in the smartcard in
<I>reader</I>

 
<DT><B>-G </B><I>output_file</I>




<DD>
Generate candidate primes for DH-GEX.
These primes must be screened for
safety (using the
-<B>T</B>

option) before use.
<DT><B>-M </B><I>memory</I>




<DD>
Specify the amount of memory to use (in megabytes) when generating
candidate moduli for DH-GEX.
<DT><B>-N </B><I>new_passphrase</I>




<DD>
Provides the new passphrase.
<DT><B>-P </B><I>passphrase</I>




<DD>
Provides the (old) passphrase.
<DT><B>-S </B><I>start</I>




<DD>
Specify start point (in hex) when generating candidate moduli for DH-GEX.
<DT><B>-T </B><I>output_file</I>




<DD>
Test DH group exchange candidate primes (generated using the
-<B>G</B>

option) for safety.
<DT><B>-W </B><I>generator</I>




<DD>
Specify desired generator when testing candidate moduli for DH-GEX.
<DT><B>-U </B><I>reader</I>




<DD>
Upload an existing RSA private key into the smartcard in
<I>reader</I>

 
<DT><B>-v</B>


<DD>
Verbose mode.
Causes
<B>ssh-keygen</B>


to print debugging messages about its progress.
This is helpful for debugging moduli generation.
Multiple
-<B>v</B>

options increase the verbosity.
The maximum is 3.
<DT><B>-r </B><I>hostname</I>




<DD>
Print the SSHFP fingerprint resource record named
<I>hostname</I>

for the specified public key file.
</DL>
<P>

<A NAME="lbAE">&nbsp;</A>
<H2>MODULI GENERATION</H2>

<B>ssh-keygen</B>


may be used to generate groups for the Diffie-Hellman Group Exchange
(DH-GEX) protocol.
Generating these groups is a two-step process: first, candidate
primes are generated using a fast, but memory intensive process.
These candidate primes are then tested for suitability (a CPU-intensive
process).
<P>

Generation of primes is performed using the
-<B>G</B>

option.
The desired length of the primes may be specified by the
-<B>b</B>

option.
For example:
<P>


<BLOCKQUOTE><TT>ssh-keygen -G moduli-2048.candidates -b 2048</TT></BLOCKQUOTE>
<P>

By default, the search for primes begins at a random point in the
desired length range.
This may be overridden using the
-<B>S</B>

option, which specifies a different start point (in hex).
<P>

Once a set of candidates have been generated, they must be tested for
suitability.
This may be performed using the
-<B>T</B>

option.
In this mode
<B>ssh-keygen</B>


will read candidates from standard input (or a file specified using the
-<B>f</B>

option).
For example:
<P>


<BLOCKQUOTE><TT>ssh-keygen -T moduli-2048 -f moduli-2048.candidates</TT></BLOCKQUOTE>
<P>

By default, each candidate will be subjected to 100 primality tests.
This may be overridden using the
-<B>a</B>

option.
The DH generator value will be chosen automatically for the
prime under consideration.
If a specific generator is desired, it may be requested using the
-<B>W</B>

option.
Valid generator values are 2, 3 and 5.
<P>

Screened DH groups may be installed in
/etc/moduli

 
It is important that this file contains moduli of a range of bit lengths and
that both ends of a connection share common moduli.
<A NAME="lbAF">&nbsp;</A>
<H2>FILES</H2>

<DL COMPACT>
<P>

<DT><B>$HOME/.ssh/identity

</B>
<DD>
Contains the protocol version 1 RSA authentication identity of the user.
This file should not be readable by anyone but the user.
It is possible to
specify a passphrase when generating the key; that passphrase will be
used to encrypt the private part of this file using 3DES.
This file is not automatically accessed by
<B>ssh-keygen</B>


but it is offered as the default file for the private key.
<A HREF="http://localhost/cgi-bin/man/man2html?1+ssh">ssh</A>(1)


will read this file when a login attempt is made.
<DT><B>$HOME/.ssh/identity.pub

</B>
<DD>
Contains the protocol version 1 RSA public key for authentication.
The contents of this file should be added to
$HOME/.ssh/authorized_keys

on all machines
where the user wishes to log in using RSA authentication.
There is no need to keep the contents of this file secret.
<DT><B>$HOME/.ssh/id_dsa

</B>
<DD>
Contains the protocol version 2 DSA authentication identity of the user.
This file should not be readable by anyone but the user.
It is possible to
specify a passphrase when generating the key; that passphrase will be
used to encrypt the private part of this file using 3DES.
This file is not automatically accessed by
<B>ssh-keygen</B>


but it is offered as the default file for the private key.
<A HREF="http://localhost/cgi-bin/man/man2html?1+ssh">ssh</A>(1)


will read this file when a login attempt is made.
<DT><B>$HOME/.ssh/id_dsa.pub

</B>
<DD>
Contains the protocol version 2 DSA public key for authentication.
The contents of this file should be added to
$HOME/.ssh/authorized_keys

on all machines
where the user wishes to log in using public key authentication.
There is no need to keep the contents of this file secret.
<DT><B>$HOME/.ssh/id_rsa

</B>
<DD>
Contains the protocol version 2 RSA authentication identity of the user.
This file should not be readable by anyone but the user.
It is possible to
specify a passphrase when generating the key; that passphrase will be
used to encrypt the private part of this file using 3DES.
This file is not automatically accessed by
<B>ssh-keygen</B>


but it is offered as the default file for the private key.
<A HREF="http://localhost/cgi-bin/man/man2html?1+ssh">ssh</A>(1)


will read this file when a login attempt is made.
<DT><B>$HOME/.ssh/id_rsa.pub

</B>
<DD>
Contains the protocol version 2 RSA public key for authentication.
The contents of this file should be added to
$HOME/.ssh/authorized_keys

on all machines
where the user wishes to log in using public key authentication.
There is no need to keep the contents of this file secret.
<DT><B>/etc/moduli

</B>
<DD>
Contains Diffie-Hellman groups used for DH-GEX.
The file format is described in
<A HREF="http://localhost/cgi-bin/man/man2html?5+moduli">moduli</A>(5).


</DL>
<P>

<A NAME="lbAG">&nbsp;</A>
<H2>SEE ALSO</H2>

<A HREF="http://localhost/cgi-bin/man/man2html?1+ssh">ssh</A>(1),


ssh-add1,


ssh-agent1,


<A HREF="http://localhost/cgi-bin/man/man2html?5+moduli">moduli</A>(5),


<A HREF="http://localhost/cgi-bin/man/man2html?8+sshd">sshd</A>(8)


<DL COMPACT><DT><DD>
J. Galbraith
R. Thayer
<I>&quot;SECSH Public Key File Format&quot;</I>
draft-ietf-secsh-publickeyfile-01.txt
March 2001
work in progress material
</DL>

<A NAME="lbAH">&nbsp;</A>
<H2>AUTHORS</H2>

OpenSSH is a derivative of the original and free
ssh 1.2.12 release by Tatu Ylonen.
Aaron Campbell, Bob Beck, Markus Friedl, Niels Provos,
Theo de Raadt and Dug Song
removed many bugs, re-added newer features and
created OpenSSH.
Markus Friedl contributed the support for SSH
protocol versions 1.5 and 2.0.
<P>

<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT><A HREF="#lbAB">NAME</A><DD>
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT><A HREF="#lbAE">MODULI GENERATION</A><DD>
<DT><A HREF="#lbAF">FILES</A><DD>
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
<DT><A HREF="#lbAH">AUTHORS</A><DD>
</DL>
<HR>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time:  GMT, September 30, 2004
</BODY>
</HTML>
